PID_FILE="./pid/server.pid"
 
# 检查PID文件是否存在
if [ -f "$PID_FILE" ]; then
    PID=$(cat "$PID_FILE")
    
    # 检查对应的进程是否正在运行
    if kill -0 "$PID" 2>/dev/null; then
        echo "Process with PID $PID is running, terminating..."
        kill -10 "$PID"
        echo "Process reload..."
    else
        echo "Process with PID $PID is not running, removing PID file..."
        rm -f "$PID_FILE"
    fi
else
    echo "PID file does not exist."
fi
